package com.aiti.lulian.service.impl;

import com.aiti.base.core.base.service.iml.BaseSerivceImpl;
import com.aiti.lulian.dto.gov.CardGovProjectApplicationDto;
import com.aiti.lulian.entity.gov.CardGovProjectApplication;
import com.aiti.lulian.mapper.gov.CardGovProjectApplicationMapper;
import com.aiti.lulian.service.ICardGovProjectApplicationService;
import com.aiti.lulian.vo.gov.CardGovProjectApplicationVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class CardGovProjectApplicationServiceImpl extends BaseSerivceImpl<CardGovProjectApplicationMapper, CardGovProjectApplication> implements ICardGovProjectApplicationService {

    @Override
    public void applyProject(CardGovProjectApplicationDto dto) {
        CardGovProjectApplication application = new CardGovProjectApplication();
        BeanUtils.copyProperties(dto, application);
        application.setCreator(dto.getUserId());
        application.setBaseCreateTime(new Date());
        this.save(application);
    }

    @Override
    public CardGovProjectApplicationVo getApplyDetails(String baseId) {
        return this.baseMapper.selectApplyDetails(baseId);
    }
}
